Integration Guide Techman LS 1.5
This guide describes how to integrate Techman robots with Locator Studio (LS) 1.5.
1. Prerequisites
Before you start, make sure that your robot controller meets these requirements:
Control box hardware version v3.2 or v5
System version 2.24 or higher (older versions are not supported)
This version of the Robot module was developed on a Techman TM12S with system version 2.24.
To check the system version of your robot, go to the top right corner of the TMflow screen:
The Techman system version is on the first line:
You also need the TMflow SW on your PC, preferably version 2.24 or higher.
The robot firmware and TMflow are free to download from the Techman download center.
The Robot module (Photoneo_LS_Module_1_5_0.zip) contains:
Locator Studio Scripts/-photoneo_main_ls.script(communication backend + default MAIN PROGRAM) and the example scripts listed in section 3.7README.md,CHANGELOG.md, the integration guide and the cheat sheet (PDF)
The Robot State Server is not part of the LS module. Use the TMCraft service from the Techman BPS 1.12 module (see section 2.7).
2. Robot Controller Setup
2.1 Initial Setup and Configuration
If you are new to Techman robots, the first setup of a locator application can be difficult, especially if the hardware package has no pendant with a screen. Techman robots usually come with a “Robot Stick”. It is good for basic runtime control, but it does not have all the functions of a traditional teach pendant. The image below shows the Robot Stick.
To start the commissioning, first connect directly to the robot controller. Connect an HDMI monitor, a USB keyboard and a mouse to the ports on the control box. With this local interface, you can see the current system configuration and make the first changes. The most important one is the network setup. This manual uses the TMflow software for all later commissioning steps. However, you must first set the IP address of the controller through this direct connection.
With an external monitor, keyboard and mouse, you have direct console access to the operating system of the robot. You need this access to set the network parameters for the remote connection from TMflow on your PC.
2.2 Network Configuration
The Techman control box has several Ethernet ports. You can use any of them for the communication. This manual uses Port 2 for the communication with the Photoneo vision controller.
To change the IP configuration, click Menu -> Settings -> System -> Network.
Select Static IP Address as the network method and enter the IP address and the subnet mask of the robot controller. This manual uses IP address 192.168.1.2 and subnet mask 255.255.255.0.
Click the Save button to confirm the changes.
Note
The subnet mask 255.255.255.0 is the same as a 24-bit subnet mask (/24). For other combinations, see this table: https://dnsmadeeasy.com/support/subnet
Example of a matching network configuration on the vision controller side:
Vision controller IPv4 address: 192.168.1.1 / 24
Robot controller IPv4 address: 192.168.1.2 / 24 (as configured in the previous step)
You can also use the Test Connection button on the Network page of the vision controller to ping the Techman robot controller.
Based on the result of the test (ping command), a Robot Available or Robot Unavailable message is shown. If the robot is unavailable, check the cables and the network configuration.
2.3 Second Network Interface for TMflow
We recommend that you configure a second Ethernet port for remote access from TMflow on a PC. This manual uses Port 1 for this. To prevent network conflicts, give this port a static IP address on a different subnet than the one used for the connection to the vision controller.
Example of a valid configuration for Port 1:
IP Address: 192.168.100.1
Subnet Mask: 255.255.255.0
Before you connect to the real robot from TMflow on your PC, set the IPv4 address of the Ethernet port of your PC. It must be on the same subnet as the Techman port, but with a different IP address.
Example IPv4 configuration of the PC with TMflow: 192.168.100.2 / 255.255.255.0
2.4 Tool TCP Setup
The tool setup is more important for Locator Studio than for Bin Picking Studio. Bin Picking Studio works with a zero tool and compensates for the tool offset in software. The general rule for Locator Studio: do all scanning and calibration in the RobotEndFlange frame, and do all picking with the real tool. This manual uses a tool named “CustomTool” with a Z offset of 205 mm.
Use the ChangeTCP TMscript command whenever you need to force the correct tool frame. For example, scan and calibration requests always need “0 RobotEndFlange”. When you pick the poses received with Get Poses, select “1 Custom Tool”.
2.5 Connecting to the Robot from TMflow
For the next configuration steps, we recommend a remote connection from a PC to the robot controller with TMflow. Use the second Ethernet port configured in section 2.3 to start a TMflow session.
Start TMflow on your PC and select one of the robot models (for example TM12S) to enter the simulation environment. From the simulation, you can then switch to a live connection with the real robot. The figure below shows the connection procedure.
In the list of found devices, select the robot by its IP address and click the “Connect” button. TMflow opens a live control session with the robot, and you have full access to the system.
2.6 Switching from Auto to Manual Mode
Before you change any program or configuration, switch the robot from “Auto” to “Manual” mode. Use this procedure on the Robot Stick:
Press and hold the M/A button until it beeps and the LED indicator starts flashing white.
Press this sequence: + , - , + , + , -
Press the M/A button again to switch to Manual mode. The LED indicator should start flashing green.
Press the M/A button once more to lock Manual mode. The LED indicator should stay solid green.
2.7 Robot State Server
The Robot State Server sends the current joint values and the Cartesian tool (TCP) pose of the robot to Locator Studio (TCP port 11004). Locator Studio uses it to show the robot and when you add calibration points on the Calibration page of the Studio. The requests of the LS module do not need it: scan_request() in hand-eye mode, capture_request() and calib_add() send the current robot pose with the request.
On Techman robots, the Robot State Server is a TMCraft service. It is shipped only in the Techman BPS 1.12 module (State Server TMCraft Service/TMserver_PHO_8ABBA73E.zip), and it also works with Locator Studio. Import and enable it as described in Installing the Robot State Server in the Techman BPS guide. After a controller restart, the service starts automatically. The Robot State Server status on the Deployment page of Locator Studio then changes to CONNECTED.
2.8 Using the Photoneo Main Script and Example Programs
The Techman robot controller can run only one script. Because of this, the Photoneo Robot module is one script that combines the ‘user frontend’ and the ‘communication backend’. This file, photoneo_main_ls.script, is the main script. Copy it to the robot as the first step of the installation.
Open photoneo_main_ls.script in a text editor on your PC. To copy the code to the Techman robot, open TMflow, go to Project, start a new project and select New Script (not New Flow):
Copy the entire code from photoneo_main_ls.script and paste it into the TMflow script.
photoneo_main_ls.script contains a basic locator sequence. It shows the essential workflow: connect to Locator Studio, trigger a scan, request an object pose and execute the pick-and-place operation.
You can easily modify photoneo_main_ls.script: replace the MAIN PROGRAM section of the code with the MAIN PROGRAM section of another example script from the module.
Example - to test the “Reuse Scan” feature, open the photoneo_reuse_scan.script file. Copy its entire MAIN PROGRAM block and paste it over the old MAIN PROGRAM block in your project.
Important
The example programs work immediately, but the feature that you want to use must first be set up and active in Locator Studio. For example, to test the Change Bounding Box function, your solution needs at least 2 bounding boxes.
The MAIN PROGRAM section of the code starts around line 160 and ends around line 262. Modify it for your application, or replace the whole section with the code from another example program. You can always go back to the original state with the code from photoneo_basic.script.
3. Robot Module
Note
We strongly recommend that you read the Photoneo robotic API before this section.
3.1 Connection to Photoneo Vision Controller
Note
The communication backend thread connects to the Action Request Server on the vision controller automatically when it starts. Two global constants are important for this step:
PHOTONEO_VC_ROBOT_PORT_IP - IP address of the vision controller port
PHOTONEO_PORT_NUM - Port number of the Action Request Server (default 11003)
Set PHOTONEO_VC_ROBOT_PORT_IP to the IP address of your vision controller. In this manual, it is 192.168.1.1.
You can send requests to the vision controller only after the connection is established. When the program on the Techman controller starts and connects, the Deployment page shows green Connected indicators (see the image below):
3.2 Request List
This section describes the API calls of the Robot module. Use these procedures for high-level control of the locator application. Each procedure passes the request to the communication backend thread, waits for the response and returns the error code (also stored in g_error_code). 0 means success. For the meaning of each request, see Action requests.
Note
These procedures are part of the communication backend. Do not edit them.
Request |
ID |
Script definition |
Input |
Populates |
|---|---|---|---|---|
Communication Check |
100 |
int comm_check_request() |
None |
g_error_code |
Calibration Start |
25 |
int calib_start(int solution_id, int vision_system_id) |
solution_id, vision_system_id |
g_error_code |
Calibration Add Point |
5 |
int calib_add() |
None (the current robot pose is sent with the request) |
g_error_code |
Calibration Save |
27 |
int calib_save() |
None |
g_error_code, g_calib_err, cal_pose_cart |
Calibration Stop |
26 |
int calib_stop() |
None |
g_error_code |
Scan Regular |
19 |
int scan_request(int vision_system_id, int hand_eye_mode) |
vision_system_id, hand_eye_mode (0 = extrinsic, 1 = hand-eye: the current robot pose is sent with the request) |
g_error_code |
Scan Meshing (Capture) |
30 |
int capture_request(int vision_system_id, int mesh_dynamic, int capture_gap) |
vision_system_id, mesh_dynamic (0 = static, 1 = dynamic), capture_gap (ms between dynamic captures); the current robot pose is sent with each capture |
g_error_code |
Reuse Scan |
31 |
int reuse_scan_request(int vision_system_id) |
vision_system_id |
g_error_code |
Get Poses |
20 |
int get_poses(int vision_system_id, int num_tar_req) |
vision_system_id, num_tar_req (maximum number of objects requested) |
g_error_code, g_num_tar_rec, file |
Get Vision System Status |
22 |
int get_status(int vision_system_id) |
vision_system_id |
g_error_code, g_num_of_localized, g_num_of_planned, g_vs_status |
Change Solution |
9 |
int solution_change(int solution_id) |
solution_id |
g_error_code |
Start Solution |
10 |
int solution_start(int solution_id) |
solution_id |
g_error_code |
Stop Solution |
11 |
int solution_stop() |
None |
g_error_code |
Get Running Solution |
12 |
int get_running_sol() |
None |
g_error_code, g_running_sol |
Change Bounding Box |
33 |
int bbox_change(int vision_system_id, int bbox_id) |
vision_system_id, bbox_id |
g_error_code |
The robot pose sent with scan_request() (hand-eye mode), capture_request() and calib_add() is the current TCP pose (Robot[0].CoordRobot). Switch the TCP to RobotEndFlange with ChangeTCP() before these requests.
3.3 Pose Handling Procedures
get_poses() deletes the old targets.txt file on the controller and writes one line for each received object: x,y,z,rx,ry,rz (position in mm, rotation in degrees, in the robot base frame). g_num_tar_rec holds the number of received objects. Use these helper procedures to read the poses:
Procedure |
Description |
|---|---|
|
Returns the pose of object |
|
Same as above, but returns a Cartesian TPoint in |
|
Returns a copy of |
Pick the objects with the real tool. Before you move to the poses, switch to it with ChangeTCP("CustomTool") (use your tool name).
3.4 Info data
Info data are extra values sent with some responses. Each value has a key (op_num). The backend reads the key and stores the value in the matching global variable below. A variable keeps the value from the last response that contained it. Use the values only if the request returned 0. The object values (keys 4-9) are sent for each object of get_poses(). After the request, the variables hold the values of the last received object. See Info data for the meaning of each key and for the requests that send it.
Key |
Info data |
Variable |
Unit in robot |
|---|---|---|---|
4 |
Dimension X |
|
mm |
5 |
Dimension Y |
|
mm |
6 |
Rotation Z |
|
deg |
7 |
NN label |
|
integer |
8 |
Max Z height |
|
mm |
9 |
Tilt |
|
deg |
10 |
Calibration accuracy |
|
mm |
11 |
Running solution ID |
|
integer |
12 |
Number of localized objects |
|
integer |
13 |
Number of pickable objects |
|
integer |
14 |
Vision system still processing |
|
0 = finished, 1 = running |
Unknown keys are read and ignored.
3.5 Global variables
Besides the Info data variables, the module uses these global variables and points (declared in the define section of photoneo_main_ls.script):
Name |
Type |
Purpose |
|---|---|---|
|
string, int |
Vision controller IP address and port (default |
|
int |
Error code of the last request (0 = no error) |
|
int |
Number of objects requested / received by |
|
int |
Scan mode set by |
|
int |
Capture mode (0 = static, 1 = dynamic) and delay between dynamic captures in ms, set by |
|
float |
Calibration accuracy from |
|
float, TPoint |
Calibration result pose from |
|
TPoint |
Scan pose and placing poses used by the example programs |
|
int |
Handshake between the MAIN PROGRAM and the backend thread |
3.6 Error codes
Every request procedure returns the error code from the vision controller (0 = no error). The module defines the constants below for readability. For the meaning of each code and how to fix it, see Error codes.
Constant |
Code |
Meaning |
|---|---|---|
|
0 |
No error |
|
2 |
Unknown request |
|
3 |
Communication error |
|
4 |
Bad data |
|
450 |
Invalid solution ID |
|
451 |
Another solution running |
|
452 |
Deployment not started |
|
453 |
Deployment is not running |
|
454 |
Deployment did not stop |
|
455 |
Solution is not complete |
|
457 |
Invalid robot brand |
|
458 |
Solution already running |
|
459 |
Solution access unauthorized |
|
460 |
Invalid vision system |
|
461 |
Calibration is already running |
|
462 |
Calibration is not running |
|
463 |
Calibration could not be stopped |
|
464 |
Calibration could not be started |
|
465 |
Automatic calibration is disabled |
|
466 |
Not enough calibration points |
|
467 |
Calibration accuracy is above the allowed threshold |
|
468 |
Scanner not available |
|
469 |
Calibration not allowed |
|
500 |
Vision system not found |
|
501 |
Empty scene |
|
502 |
No object found, detection running |
|
503 |
No object found, detection stopped |
|
504 |
All objects rejected, detection running |
|
505 |
All objects rejected, detection stopped |
Codes without a constant can also be returned. For example, bbox_change() returns 222 (Invalid bounding box) if the bounding box ID does not exist.
Error handling in the module:
The connection to the vision controller is opened once, when the backend thread starts (
ThreadRun(locator_backend(), False)at the top of MAIN PROGRAM). Each socket read waits up to 10 s.Request errors are only returned. The MAIN PROGRAM decides what to do (the example programs show the code with
Display()and then retry the cycle).If the vision controller is restarted or the cable is disconnected, stop and restart the script to reconnect.
3.7 Example Programs
The Photoneo Techman module contains several example programs. They show how to use the requests from section 3.2 in different use cases. Each file contains only a MAIN PROGRAM block. Paste it over the MAIN PROGRAM block of photoneo_main_ls.script (see section 2.8).
Techman Example |
Description |
|---|---|
|
Shows the basic workflow: connect to the vision controller, send a scan request, request and receive object poses and execute the picks.
The example also shows error handling: each function returns an error value, which is assigned to |
|
Basic calibration example. Requirements: The user must start and confirm the first calibration of the vision system manually in Locator Studio. Automatic recalibration must be enabled for the vision system. Calibration Steps
Important: The calibration object must stay where it was during the first calibration. The calibration ball stays mounted in the same place on the flange or gripper and moves with the robot. The marker pattern stays in the same place in the cell. Otherwise, the automatic recalibration fails. |
|
Same as photoneo_basic, but switches between two vision systems.
The |
|
Same as photoneo_basic, but switches between two bounding boxes of VS1 after each cycle with |
|
Same as photoneo_basic, but uses all requests for solution switching.
It stops the running solution with |
|
Same as photoneo_basic, but calls get_status several times.
You can call |
|
Static Meshing example. Shows how to stitch multiple scans before the localization starts. This is useful for complex scenes or large objects. In the static approach, the robot stops at each scanning position to trigger and capture a scan. Procedure
|
|
Dynamic Meshing example. This setup uses the Photoneo Instant Meshing technology in LS together with the Parallel Structured Light technology of the MotionCam-3D. Dynamic Meshing does not work with standard PhoXi 3D Scanners. Requirements
Procedure
|
|
Same as the photoneo_multiple_vision_systems example, but adds the LS feature
|
The MAIN PROGRAM of photoneo_basic.script:
main
{
int error_code
int solution_id
int vision_system_id
// Start locator backend communication thread
ThreadRun(locator_backend() , False)
// Main loop
while (1)
{
//---------------------------------------------------------
// 1. VISION ACQUISITION
//---------------------------------------------------------
// Move to Scan Position
PTP("JPP", Point["scan"].Joint, 100, 200, 100, false)
QueueTag(1, 1)
vision_system_id = 1
error_code = scan_request(vision_system_id, 0) // 0 = Extrinsic scan
if (error_code != 0) {
Display("PHOCLIENT: Scan Error: " + error_code)
WaitFor(5000)
continue
}
// Wait for processing to complete on Locator Studio side
WaitFor(2000)
//---------------------------------------------------------
// 2. RETRIEVE RESULTS FROM LOCATOR STUDIO INTO TARGETS.TXT
//---------------------------------------------------------
// Request object poses from Locator Studio
error_code = get_poses(vision_system_id, 5) // Requesting up to 5 poses
if (error_code != 0 || g_num_tar_rec == 0) {
Display("PHOCLIENT: Failed to retrieve poses")
continue
}
Display("Received: " + g_num_tar_rec + " objects")
//---------------------------------------------------------
// 3. EXECUTION (Pick & Place)
//---------------------------------------------------------
// Execution loop to read targets from file and execute movements
for (int i = 1; i <= g_num_tar_rec; i++) {
// Read Target Pose
float[] obj_pose = read_pose_from_textfile(i)
// Calculate approach point with Z 100mm
float[] approach_pose = get_approach_pose(obj_pose, 0, 0, 100)
// Set TCP to real tool
ChangeTCP("CustomTool")
// Pick target
Display("Executing Target " + i + ": X=" + obj_pose[0] + " Y=" + obj_pose[1] + " Z=" + obj_pose[2])
PTP("CPP", approach_pose, 100, 200, 5, true)
PTP("CPP", obj_pose, 100, 200, 5, true)
// Add gripper/logic here if needed
// gripper_attach()
PTP("CPP", approach_pose, 100, 200, 5, true)
QueueTag(1, 1)
// Placing
// PTP("JPP", Point["drop"].Joint, 100, 200, 100, false)
// gripper_detach()
// Return to home/scan position after processing the batch
PTP("JPP", Point["scan"].Joint, 100, 200, 100, false)
QueueTag(1, 1)
}
} // ENDWHILE - Main execution loop
} // ENDMAIN - program
4. Runtime
When the solution is fully configured on the vision controller, finish the remaining steps on the robot side and run photoneo_main_ls.script.
4.1 Teach Positions
After you open photoneo_main_ls.script or another example program, touch up a few local poses before you run the program. See the TPoint declarations below:
Besides the 3 local poses scan, drop_up and drop_down, you must also define the approach point offsets. They set the direction from which the robot approaches the target point.
The easiest way to touch up poses in TMscript: jog the robot to the required pose and press the Point/Target 🞋 button on the robot flange. This creates a new TPoint variable at the end of the define section of your script and records the point (see the image below). From there, copy the joint or Cartesian values to the main poses.
4.2 Gripper Commands
photoneo_main_ls.script has no gripper procedures by default. Add them to the code at the correct places. See the example below:
4.3 Runtime Prerequisites
Do a final check before you start the Locator Studio program on the robot.
Make sure that:
The Locator Studio solution is correctly configured on the vision controller.
The network setup on the robot side is complete (and the Robot State Server works, if installed).
All vision systems in the solution are calibrated.
All local poses in the main program are touched up.
The gripper procedures are ready and working.
4.4 Running the photoneo_main_ls Script
Deploy your solution. Until the communication is established, the Deployment page shows the Action Request Client (Robot) status as DISCONNECTED.
Note
Before you run the program for the first time, we strongly recommend that you decrease the override speed to 5%.
When the connection is established, the Action Request Client and Robot State Server status changes to CONNECTED. The sensor should then capture the first scan, and the localization should start.
If there is a pickable object in the scene and the robot controller has received its Cartesian pose, the robot should start moving towards the object.
If everything looks fine, let the robot continue towards the first object and check that the path is correct. If the robot stops too far from the object or pushes it too deep, adjust the object origin or the tool TCP setup.
If the robot movement looks fine, set up your own placing routine and slowly increase the speed back to 100%.
You have successfully deployed the Photoneo Techman Robot module. You can now improve your application further. Use the cheat sheet and the example programs as a guide.
5. Version and Brand ID
Item |
Value |
|---|---|
Robot module version |
1.5.0 (Locator Studio 1.5) |
Brand ID sent after connecting |
|
Action Request Server port |
11003 ( |
The backend thread sends the brand ID right after it opens the socket (brand_msg in locator_backend()). Do not change it. The supported features of all Robot modules are listed in the Robot module support matrix.
6. Migration
The Techman LS module was first released for Locator Studio 1.4. Version 1.5 changes how Info data are received (one value per key, see section 3.4). It also adds g_obj_nn_label and the Communication check request (comm_check_request()) and updates the brand ID. To upgrade, replace the whole backend part of your script with the backend from the new photoneo_main_ls.script. Keep your MAIN PROGRAM.
See Migration guide 1.4.x to 1.5.x for details.